<?php

namespace App\Http\Controllers\Merchant;

use App\Http\Controllers\Controller;
use App\Model\Merchant;
use App\Common\Common as common;
class MerchantController extends Controller
{
    public function add(){
        $request = $this->param;
        
        $validatorRule = ['companyName','abutmentName','abutmentPhone'];
        
        $flag = common::validateRequestField($request,$validatorRule);
        if( $flag !== true ) common::error(0,$flag);
        $insertData = [
            'companyName'=>$request['companyName'],
            'abutmentName'=>$request['abutmentName'],
            'abutmentPhone'=>$request['abutmentPhone'],
            'addTime'=>date('Y-m-d')
        ];
        Merchant::insertGetId($insertData);
        return common::success('添加商户成功');
    }
}
